package com.wuzhazha.javamind.chapter15.test04;

/**
 * 斐波那契数列生成器
 */
public class Fibonacci implements Generator<Integer> {

    private int count = 0 ;

    public Integer next() {
        return fib(count++);
    }

    private int fib(int n){
        if(n < 2){
            return 1;
        }
        return fib(n-2) + fib(n-1);
    }
}
